package com.lm.geode.config;

import com.lm.geode.entry.User;
import org.apache.geode.cache.client.ClientCache;
import org.apache.geode.cache.client.ClientCacheFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.gemfire.config.annotation.EnableClusterDefinedRegions;
import org.springframework.data.gemfire.config.annotation.EnableEntityDefinedRegions;
import org.springframework.data.gemfire.config.annotation.ClientCacheApplication;

@Configuration
@ClientCacheApplication(name = "GeodeClient", logLevel = "config")
@EnableEntityDefinedRegions(basePackages = "com.lm.geode.entry")
@EnableClusterDefinedRegions
public class GeodeConfig {

    @Bean
    public org.apache.geode.cache.client.ClientRegionShortcut clientRegionShortcut() {
        return org.apache.geode.cache.client.ClientRegionShortcut.PROXY;
    }

    @Bean
    public ClientCache clientCache() {
        return new ClientCacheFactory()
                .addPoolLocator("localhost", 10334) // 指定你的 locator
                .set("name", "GeodeClient")
                .create();
    }
}